<?php ob_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>

        <link rel="stylesheet" type="text/css" href="css/easyui.css">
        <link rel="stylesheet" type="text/css" href="css/icon.css">
        <script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>
        <script type="text/javascript" src="../js/jquery.easyui.min.js"></script>
        
        <script type="text/javascript">
            function saveData() {
                $("#ff").submit();
            }

            $(function(){
                $('#ff').form({
                    onSubmit:function(){
                        return $(this).form('validate');  
                    },  
                    success:function(data){
                        $.messager.alert('Info', data, 'info');
                        clearForm();
                    }
                });
            });
            
            $(document).ready(function () { 
                clearForm();
            });
            
            function clearForm() {
                //                $("#name").val('');
                //                $("#email").val('');
                //                $("#subject").val('');
                //                $("#message").val('');
            }
        </script>

    </head>
    <body>
        <?php
        include 'header.php';

        include 'inc/conn.php';
        $sql = "select * from ats_company";
        $rs = mysql_query($sql);

        $row = mysql_fetch_row($rs);
        ?>
        <h2>COMPANY INFORMATIONS</h2>
        <form id="ff" action="company_update.php" method="post">
            <table border="0" width="50%" cellspacing="3">
                <tr>
                    <td style="border: none;" width="20%"><label>Name:</label></td>
                    <td style="border: none;">
                        <input type="text" name="companyname" value="<?php echo $row[0]; ?>"
                               class="easyui-validatebox" required="true" />
                    </td>
                </tr>
                <tr>
                    <td style="border: none;"><label>Address Line 1:</label></td>
                    <td style="border: none;"><input type="text" name="address1"  value="<?php echo $row[1]; ?>"
                                                     class="easyui-validatebox" /></td>
                </tr>
                <tr>
                    <td style="border: none;"><label>Address Line 2:</label></td>
                    <td style="border: none;"><input type="text" name="address2"  value="<?php echo $row[2]; ?>"
                                                     class="easyui-validatebox" /></td>
                </tr>
                <tr>
                    <td style="border: none;"><label>Region:</label></td>
                    <td style="border: none;"><input type="text" name="region"  value="<?php echo $row[3]; ?>"
                                                     class="easyui-validatebox" /></td>
                </tr>
                <tr>
                    <td style="border: none;"><label>City:</label></td>
                    <td style="border: none;"><input type="text" name="city"  value="<?php echo $row[4]; ?>"
                                                     class="easyui-validatebox" /></td>
                </tr>
                <tr>
                    <td style="border: none;"><label>Country:</label></td>
                    <td style="border: none;"><input type="text" name="country"  value="<?php echo $row[5]; ?>"
                                                     class="easyui-validatebox" /></td>
                </tr>
                <tr>
                    <td style="border: none;"><label>Phone 1:</label></td>
                    <td style="border: none;"><input type="text" name="phone1"  value="<?php echo $row[6]; ?>"
                                                     class="easyui-validatebox" /></td>
                </tr>
                <tr>
                    <td style="border: none;"><label>Phone 2:</label></td>
                    <td style="border: none;"><input type="text" name="phone2"  value="<?php echo $row[7]; ?>"
                                                     class="easyui-validatebox" /></td>
                </tr>
                <tr>
                    <td style="border: none;"><label>FAX 1:</label></td>
                    <td style="border: none;"><input type="text" name="fax1"  value="<?php echo $row[9]; ?>"
                                                     class="easyui-validatebox" /></td>
                </tr>
                <tr>
                    <td style="border: none;"><label>FAX 2:</label></td>
                    <td style="border: none;"><input type="text" name="fax2"  value="<?php echo $row[10]; ?>"
                                                     class="easyui-validatebox" /></td>
                </tr>
                <tr>
                    <td style="border: none;"><label>Email:</label></td>
                    <td style="border: none;"><input type="text" name="email"  value="<?php echo $row[11]; ?>"
                                                     class="easyui-validatebox" validType="email" /></td>
                </tr>
                <tr>
                    <td style="border: none;"><label>Scroll text:</label></td>
                    <td style="border: none;"><input type="text" name="scrolltext"  value="<?php echo $row[12]; ?>"
                                                     class="easyui-validatebox" /></td>
                </tr>
            </table>

        </form>

        <br />
        <div id="dlg-buttons">
            <a href="#"
               class="easyui-linkbutton"
               iconCls="icon-ok"
               onclick="saveData();">Save</a>
        </div>
        <?php ob_end_flush(); ?>
        
    </body>
</html>